<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
 <head>
  <title></title>
  <style type="text/css" media="all">
	@import "<%=basePath %>editor/css/style.css";
  </style>
  <link href="<%=basePath %>web/index_css.css" rel="stylesheet" type="text/css" />
  <script language="javascript">  
		function updatepwd(obj){
          if (obj.title.value==""){alert("请填写日志标题！");obj.title.focus();return false;}
          document.getElementById('showhtml').value = me.getCont();
		  obj.submit();
		}
	</script>
 </head>
 <body>
 <c:if test="${!empty msg}">
     <script type="text/javascript">
         alert("${msg}");  
     </script>
     <c:remove var="msg" scope="session"/>
   </c:if>
<table border="0" width="100%" style="font-size: 14px;">
       <tr>
        <td colspan="4" align="center" style="font-size: 16px;color: #FD8305; font-weight: bold;">
          我的日志
        </td>
       </tr> 
       <tr height="20" bgcolor="#FD8305" align="center" style="color: white;font-size: 13px;font-weight: bold;">
        <td width="60">日志编号</td>
        <td width="380">日志标题</td>
        <td width="60" align="center">发表时间</td>  
        <td width="100">浏览量</td>
        <c:if test="${'0' eq role}">
	     <c:if test="${memberid eq manager.mid}">
	      <c:if test="${null ne manager.mid}">
	       <td>删除</td>
	      </c:if>
	     </c:if>
	   </c:if>
       </tr>                                                                       
		<c:if test="${!empty pm.datas}">
		<c:forEach items="${pm.datas}" var="mylog">
			<tr height="20">
				<td>
					&nbsp;${mylog.tid }
				</td>
				<td>
				 <a href="<%=basePath%>logs/${mylog.tid }.html" target="_blank" style="text-decoration: underline;" >
					<c:choose> 
						    <c:when test="${fn:length(mylog.title) > 20}"> 
						     <c:out value="${fn:substring(mylog.title, 0, 20)}..." /> 
						    </c:when> 
						    <c:otherwise> 
						     <c:out value="${mylog.title}" /> 
						    </c:otherwise> 
					</c:choose>&nbsp;
				 </a>
				</td>
				<td align="left" style="font-size: 12px;">
					<fmt:formatDate value="${mylog.ttime }" pattern="yyyy-MM-dd HH:mm"/>
				</td>
				<td align="center">
					${mylog.num }
				</td>
				<c:if test="${'0' eq role}">
			     <c:if test="${memberid eq manager.mid}">
			      <c:if test="${null ne manager.mid}">
			       <td align="center"><a href="marticle!delMArticleByMid.action?tid=${mylog.tid }" style="font-size: 12px;text-decoration: underline;color: #FD8305;">删除</a></td>
			      </c:if>
			     </c:if>
			   </c:if>
			</tr>
		</c:forEach>
		</c:if>
		<c:if test="${empty pm.datas}">
		<tr>
			<td colspan="4" align="center">
				没有找到相应的记录
			</td>
		</tr>
		</c:if>
		<c:if test="${null ne pm.datas[0].mid}">
		   <tr height="30">
		    <td colspan="4" align="right">
		    <pg:pager url="marticle!findArticleByLimit.action" items="${pm.total}"
		export="currentPageNumber=pageNumber" maxPageItems="10"
		maxIndexPages="10">
		<pg:first>
		<a href="${pageUrl}&mid=${pm.datas[0].mid }">首页</a>
		</pg:first>  
		                                 [第${currentPageNumber}页]/[共${pm.total}条记录]
		                                <pg:prev>
		<a href="${pageUrl }&mid=${pm.datas[0].mid }">上一页</a>
		</pg:prev>
		<pg:pages>
		<c:choose>
			<c:when test="${currentPageNumber eq pageNumber}">
				<font color="red">${pageNumber }</font>
			</c:when>
			<c:otherwise>
				<a href="${pageUrl }">${pageNumber }</a>
			</c:otherwise>
		</c:choose>
		</pg:pages>
		<pg:next>
		<a href="${pageUrl }&mid=${pm.datas[0].mid }">下一页</a>
		</pg:next>
		<pg:last>
		<a href="${pageUrl }&mid=${pm.datas[0].mid }">尾页</a>
		</pg:last>
		</pg:pager>
		   </td>
	 </tr>
	 </c:if>
	 <c:if test="${'0' eq role}">
	 <c:if test="${memberid eq manager.mid}">
	  <c:if test="${null ne manager.mid}">
	 <tr height="30">
	   <td colspan="4" style="font-size: 14px;color: #FD8305; font-weight: bold;">发表日志(请不要发表于国家法律法规相违背的任何言论)</td>
	 </tr>
	 <tr>
	   <td colspan="4" align="left">
	    <form name="form1" id="form1" method="post" action="marticle!addArticle.action" style="line-height: 150%;font-size: 13px;">
	      &nbsp;&nbsp;&nbsp;日志标题: <input type="text" name="marticle.title" id="title" size="60"/><br/>
	       <br/>
		  <script type="text/javascript" src="<%=basePath %>editor/mEditor.js"></script>
		  <script type="text/javascript">
			/*
			// 编辑区id，语言(zh，en)，编辑区宽度，字体，字号，颜色，图片提示，链接提示，填充内容(可为''或null或胜略)
			// ff，fz，fc，tip11，tip12 用于显示，区分不同的语言
			new mEditor(id, lang, width, fn, fz, fc, tip11, tip12, fill);
			
			mEditor.getCont()	// 取得内容
			mEditor.selectAll()	// 选中所有内容
			mEditor.clear()		// 清空
			mEditor.focus()		// 聚焦
			mEditor.insert(cont, clear)	// 插入html代码（JS？），clear：是否清空内容
			 */
			
			var me = createME('brief', 550, '');
			me.insert('日志内容', true);
			me.mv2begin();
			me.focus();
		 </script>
		    <input type="hidden" name="marticle.content" id="showhtml"/>
			<hr/>
			<input type="button" value="发表日志" onmousedown="return updatepwd(form1);" style="font-size: 15px;"/>
			 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="reset" value="清空日志"/>
	   </form>
	   </td>
	  </tr>
	  </c:if>	  
	</c:if>
	</c:if>
</table>  
</body>   
</html>                     